<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@	taglib	uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE html>
<html>
<head>
	<title>购物车</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link type="text/css" rel="stylesheet" href="css/header.css">
	<link type="text/css" rel="stylesheet" href="css/goods_cart.css">
	<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet">
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="layer/layer.js"></script>
	<script type="text/javascript" src="js/cart.js"></script>
</head>
<body>
	
	
<!-- 头部 -->
<jsp:include page="/header.jsp"></jsp:include>

	
	<!--cart-items-->
	<div class="cart-items">
    <div class="container">
        <h2>我的购物车</h2>

        <!-- 循环显示购物车中的商品 -->
        <c:forEach items="${orders.itemMap }" var="item">
            <div class="cart-header col-md-6">
                <div class="cart-sec simpleCart_shelfItem">
                    <div class="cart-item cyc">
                        <a href="${pageContext.request.contextPath }/goods_detail?id=${item.key }">
                            <img src="${pageContext.request.contextPath }${item.value.goods.cover }" class="img-responsive">
                        </a>
                    </div>
                    <div class="cart-item-info">
                        <h3><a href="${pageContext.request.contextPath }/goods_detail?id=${item.key }">${item.value.goods.name }</a></h3>
                        <h3><span>单价: ¥ ${item.value.price }</span></h3>
                        <h3>
                            <!-- 数量调整部分 -->
                            <div class="quantity-controls">
                                <a class="btn btn-warning" href="javascript:lessen(${item.key });">-</a>
                                <span class="quantity">${item.value.amount}</span>
                                <a class="btn btn-info" href="javascript:buy(${item.key });">+</a>
                            </div>
                        </h3>
                        <a class="btn btn-danger" href="javascript:deletes(${item.key });">删除</a>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>            
        </c:forEach>

        <!-- 订单总金额和提交订单按钮 -->
        <div class="cart-header col-md-12">
            <hr>
            <h3>订单总金额: ¥ ${orders.total }</h3>
            <a class="btn btn-success btn-lg" style="margin-left:74%" href="${pageContext.request.contextPath }/orders_submit">提交订单</a>
        </div>
    </div>
</div>

	<!--//cart-items-->	
	
	


<!-- 尾部 -->
<jsp:include page="/footer.jsp"></jsp:include>



</body>
</html>